//
//  SWModifyChildInfoReq.swift
//  ChildStory
//
//  Created by linhan on 16/9/1.
//  Copyright © 2016年 Aiya. All rights reserved.
//

import Foundation
class SWModifyChildInfoReq: SWBaseRequest
{
    var child:SWChild
    
    init(child:SWChild)
    {
        self.child = child
        super.init()
        api = SWRequestAPI.ModifyChildInfo
    }
    
    override var params:Any?
    {
        var param:[String:Any] = [:]
        if let avatarURL = child.avatarURL , avatarURL != ""
        {
            param["avatar"] = avatarURL
        }
        
        if let screenName = child.screenName , screenName != ""
        {
            param["name"] = screenName
        }
        
        if let infantName = child.infantName , infantName != ""
        {
            param["infant_name"] = infantName
        }
        
        if let birthday = child.birthday
        {
            param["birthday"] = (birthday as NSDate).formattedDate(withFormat: "yyyy-MM-dd")
        }
        
        param["baby_id"] = child.uid ?? ""
        param["gender"] = child.gender.responseValue
        
        return param
    }
}
